Crate terminal_size
source ·Expand description
A simple utility for getting the size of a terminal.
Supports both Linux, MacOS, and Windows.
This crate requires a minimum rust version of 1.48.0 (2020-11-19)
Example
use terminal_size::{Width, Height, terminal_size};
let size = terminal_size();
if let Some((Width(w), Height(h))) = size {
println!("Your terminal is {} cols wide and {} lines tall", w, h);
} else {
println!("Unable to get terminal size");
}
Structs
Functions
- Returns the size of the terminal.
- Returns the size of the terminal using the given file descriptor, if available.